package com.sdx.console.live.service;

import com.ibeetl.admin.core.entity.BaseEntity;
import com.ibeetl.admin.core.service.BaseService;
import com.ibeetl.admin.core.util.PlatformException;
import com.sdx.console.live.dao.CourseLiveDao;
import com.sdx.console.live.entity.CourseLive;
import org.beetl.sql.core.engine.PageQuery;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * 直播 Service
 */

@Service
@Transactional
public class CourseLiveService extends BaseService<CourseLive>{

    @Resource
	private CourseLiveDao courseLiveDao;

    public PageQuery<CourseLive>queryByCondition(PageQuery query){
        PageQuery ret =  courseLiveDao.queryByCondition(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public void batchDelCourseLive(List<String> ids){
        try {
            courseLiveDao.batchDelCourseLiveByIds(ids);
        } catch (Exception e) {
            throw new PlatformException("批量删除直播失败", e);
        }
    }

	public List<CourseLive> all() {
		return courseLiveDao.all();
		}

    public List<BaseEntity> getLecture(String teacherId) {
        return  courseLiveDao.getLecture( teacherId);
    }
}